﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SocketLib
{
	public class ConnectionList : System.Collections.CollectionBase
	{
		public ConnectionList()
		{
		}

		public void Add(Connection value)
		{
			
			List.Add(value);

		}

		public void Remove(Connection value)
		{
			List.Remove(value);
		}


		public bool Contains(Connection value)
		{
			return (List.Contains(value));
		}


		public Connection this[int index]
		{

			get
			{

				return List[index] as Connection;

			}

			set
			{

				List[index] = value;

			}

		}

		public Connection this[string connectionName]
		{

			get
			{

				foreach (Connection connection in List)
				{

					if (connection.ConnectionName == connectionName)

						return connection;

				}

				return null;

			}
		}

	}
}
